home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dr. Windows 3
/
dr win3.zip
/
dr win3
/
PROGRAMR
/
OLE2BOOK.ZIP
/
CHAP09.ZIP
/
CHAP09
/
PATRON
/
IADVSINK.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-06-13
|
4KB
|
209 lines
/*
* IADVSINK.CPP
*
* Implementation of the IAdviseSink interface for Patron's tenants.
*
* Copyright (c)1993 Microsoft Corporation, All Rights Reserved
*
* Kraig Brockschmidt, Software Design Engineer
* Microsoft Systems Developer Relations
*
* Internet : kraigb@microsoft.com
* Compuserve: >INTERNET:kraigb@microsoft.com
*/
#include "patron.h"
/*
* CImpIAdviseSink::CImpIAdviseSink
* CImpIAdviseSink::~CImpIAdviseSink
*
* Parameters (Constructor):
* pTenant LPTENANT of the tenant we're in.
* punkOuter LPUNKNOWN to which we delegate.
*/
CImpIAdviseSink::CImpIAdviseSink(LPTENANT pTenant, LPUNKNOWN punkOuter)
{
m_cRef=0;
m_pTen=pTenant;
m_punkOuter=punkOuter;
return;
}
CImpIAdviseSink::~CImpIAdviseSink(void)
{
return;
}
/*
* CImpIAdviseSink::QueryInterface
* CImpIAdviseSink::AddRef
* CImpIAdviseSink::Release
*
* Purpose:
* IUnknown members for CImpIAdviseSink object.
*/
STDMETHODIMP CImpIAdviseSink::QueryInterface(REFIID riid, LPVOID FAR *ppv)
{
return m_punkOuter->QueryInterface(riid, ppv);
}
STDMETHODIMP_(ULONG) CImpIAdviseSink::AddRef(void)
{
++m_cRef;
return m_punkOuter->AddRef();
}
STDMETHODIMP_(ULONG) CImpIAdviseSink::Release(void)
{
--m_cRef;
return m_punkOuter->Release();
}
/*
* IAdviseSink::OnDataChange
*
* Unused since we don't IDataObject::Advise.
*/
STDMETHODIMP_(void) CImpIAdviseSink::OnDataChange(LPFORMATETC pFEIn
, LPSTGMEDIUM pSTM)
{
return;
}
/*
* IAdviseSink::OnViewChange
*
* Purpose:
* Notifes the advise sink that presentation data changed in the data
* object to which we're connected providing the right time to update
* displays using such presentations.
*
* Parameters:
* dwAspect DWORD indicating which aspect has changed.
* lindex LONG indicating the piece that changed.
*
* Return Value:
* None
*/
STDMETHODIMP_(void) CImpIAdviseSink::OnViewChange(DWORD dwAspect, LONG lindex)
{
//This only requires a repaint, which our tenant makes simple for us.
//CHPATER9MOD
//Repaint only if this is the right aspect
if (dwAspect==m_pTen->m_fe.dwAspect)
m_pTen->Repaint();
//End CHAPTER9MOD
m_pTen->m_pPG->m_fDirty=TRUE;
return;
}
/*
* IAdviseSink::OnRename
*
* Purpose:
* Informs the advise sink that an IOleObject has been renamed, primarily
* when its linked.
*
* Parameters:
* pmk LPMONIKER providing the new name of the object
*
* Return Value:
* None
*/
STDMETHODIMP_(void) CImpIAdviseSink::OnRename(LPMONIKER pmk)
{
/*
* As a container this is unimportant to us since it really
* tells the handler's implementation of IOleLink that the
* object's moniker has changed. Since we get this call
* from the handler, we don't have to do anything ourselves.
*/
return;
}
/*
* IAdviseSink::OnSave
*
* Purpose:
* Informs the advise sink that the OLE object has been saved
* persistently. The primary purpose of this is for containers that
* want to make optimizations for objects that are not in a saved
* state, so on this you have to disable such optimizations.
*
* Parameters:
* None
*
* Return Value:
* None
*/
STDMETHODIMP_(void) CImpIAdviseSink::OnSave(void)
{
/*
* A Container has nothing to do here as this notification is only
* useful when we have an ADVFCACHE_ONSAVE advise set up, which
* we don't. So we ignore it.
*/
return;
}
/*
* IAdviseSink::OnClose
*
* Purpose:
* Informs the advise sink that the OLE object has closed and is
* no longer bound in any way.
*
* Parameters:
* None
*
* Return Value:
* None
*/
STDMETHODIMP_(void) CImpIAdviseSink::OnClose(void)
{
/*
* This doesn't have anything to do with us again as it's only used
* to notify the handler's IOleLink implementation of the change
* in the object. We don't have to do anything since we'll also
* get an IOleClientSite::OnShowWindow(FALSE) to tell us to repaint.
*/
return;
}